import re

'''
search方法会在整个字符串中进行严格匹配
如果不匹配则返回None
'''

# 模板
reg = 'python'
# 待匹配的字符串
str = 'I love python'

m = re.search(reg, str)

print(m)
# <re.Match object; span=(7, 13), match='python'>

print(m.group())
# python